package com.gzsxy.sso.core.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gzsxy.sso.common.model.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.security.core.GrantedAuthority;


/**
 *  用户实体
 * @author zxl
 * @since 2021-11-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)  //设置为true，则setter方法返回当前对象
@TableName("t_user")
@ApiModel(value="User对象", description="")
public class User extends BaseEntity implements Serializable {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "用户名")
    private String userName;

    @ApiModelProperty(value = "真实姓名")
    private String realName;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "身份证号")
    private String idCard;

    @ApiModelProperty(value = "电话")
    private String phone;

    @ApiModelProperty(value = "头像")
    private String imagePath;

    @ApiModelProperty(value = "学校")
    private String school;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "余额")
    private Integer amount;

    @ApiModelProperty(value = "是否冻结")
    private Boolean freeze;

    @ApiModelProperty(value = "排序")
    private Integer sort;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "最后登录时间")
    private Date lastLoginTime;

    //权限认证  --不参与数据库查询
    @TableField(exist = false)
    private List<GrantedAuthority> authorities = new ArrayList<>();

    //--不参与数据库查询
    @TableField(exist = false)
    private List<String> roleId;


}
